package com.njcs.treeset;

/**
 * @author Sam.Lee E-mail:lishanman2007@163.com
 * @version Created：Nov 1, 2011 3:07:53 PM
 */

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class TreeSetTest {
	public static void main(String[] args) {
		Set<Customer> set = new TreeSet<Customer>();
		set.add(new Customer("Tom", 15));
		set.add(new Customer("Tom", 20));
		set.add(new Customer("Tom", 15));
		set.add(new Customer("Mike", 15));

		Iterator<Customer> it = set.iterator();
		while (it.hasNext()) {
			Customer customer = it.next();
			System.out.println(customer.getName() + " " + customer.getAge());
		}
	}

}